package com.deepocean.service.impl;

import com.deepocean.dao.FloatationDao;
import com.deepocean.entity.FloatationInAndOut1Hour;
import com.deepocean.entity.FloatationMachineCondition;
import com.deepocean.entity.FloatationMachineEntity;
import com.deepocean.service.IFloatationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class FloatationServiceImpl implements IFloatationService {
    @Autowired
    FloatationDao floatationDao;

    @Override
    public boolean add(FloatationMachineEntity floatationMachineEntity) {
        String id = UUID.randomUUID().toString().replaceAll("-", "");
        floatationMachineEntity.setId(id);
        return floatationDao.add(floatationMachineEntity);
    }

    @Override
    public FloatationInAndOut1Hour getInAndOutInHour(String deviceId) {
        return floatationDao.getInAndOutInHour(deviceId);
    }

    @Override
    public List<FloatationMachineEntity> getFloatationByCondition(FloatationMachineCondition floatationMachineCondition) {
        return floatationDao.getFloatationByCondition(floatationMachineCondition);
    }
}
